<template>
  <div class="hearing-report">
    <crumb />
    <div class="container">
      <div class="box-left">
        <div class="task-name">任务名称：{{historyData.oralName}}</div>
        <div class="task-speak">
          <div class="sub-head">任务要求:</div>
          {{historyData.oralRemark}}
        </div>
        <div class="task-num">答题数量：{{historyData.subjectNum}}题</div>

        <div class="task-over-box">
          <div class="task-name"> 历史得分趋势</div>
          <vlin :data="chartData" :settings="chartSettings" :extend='chartExtend'></vlin>
        </div>
      </div>
      <div class="box-right">
        <!-- 训练报告 -->
        <div class="table table-1">
          <div class="table-head">
            跟读成绩
            <!-- <time>{{historyData.maxCreateTime}}</time> -->
          </div>
          <div class="table-content">
            <div>
              <div class="circle left">{{historyData.totalduration?historyData.totalduration+'S':'暂无'}}</div>
              <div class="text">时长</div>
            </div>
            <div>
             <div class="circle center">{{historyData.score?historyData.score:'暂无'}}</div>
             <div class="text">得分</div>
            </div>
            <div>
              <div class="circle right">{{historyData.rank?historyData.rank:'暂无'}}</div>
              <div class="text">排名</div>
            </div>
          </div>
        </div>
        <!-- 答题情况 -->
        <div class="table table-2">
          <div class="table-head">历史训练记录</div>
          <div class="table-content">
             <el-table border :data="historyData.historyList" style="width: 100%">
              <el-table-column align="center" prop="createdTime" show-overflow-tooltip label="时间"></el-table-column>
              <el-table-column align="center" prop="score" show-overflow-tooltip label="得分"></el-table-column>
              <el-table-column align="center" prop="duration" show-overflow-tooltip label="用时(S)"></el-table-column>
            </el-table>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { speechHistory } from '@/api/student/training/speech'
import vlin from 'v-charts/lib/line.common'
export default {
  name: 'SkillFollowHistory',
  data () {
    this.chartSettings = {
      labelMap: {
        'score': '分数'
      }
    }
    this.chartExtend = {
      legend: {
        show: false
      }
    }
    return {
      reporInfoData: [],
      historyData: {},
      chartData: {
        columns: ['createdTime', 'score'],
        rows: []
      }
    }
  },
  components: { vlin },
  mounted () {
    this.speechHistory()
  },
  methods: {
    async speechHistory () {
      let res = await speechHistory(
        {
          'lessonOralCatalogId': this.$route.query.lessonOralCatalogId,
          'resourceOralId': this.$route.query.resourceOralId,
          stuId: '',
          isTeacher: ''
        }
      )
      if (res.code === '200') {
        this.historyData = res.data
        this.chartData.rows = res.data.historyList
        console.log('==@', res)
      } else {
        this.$message.error(res.message)
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.hearing-report {
  .container {
    display: flex;
    justify-content: space-between;
    .box-left {
      width: 590px;
      background: #fff;
      padding: 20px;
      .task-name {
        font-size: 16px;
        font-weight: bold;
      }
      .task-speak {
        background: #f5f5f5;
        margin-top: 20px;
        padding: 10px;
        border-radius: 10px 10px 0 0;
        font-size: 14px;
        line-height: 1.5;
        .sub-head {
          color: #009cf6;
          font-weight: bold;
          margin-bottom: 5px;
        }
      }
      .task-num {
        background: #f5f5f5;
        color: #ff905a;
        border-radius: 0 0 10px 10px;
        padding: 0 10px 20px 10px;
        font-size: 14px;
      }
      .task-over-box {
        font-size: 14px;
        position: relative;
        margin-top: 20px;
        .head {
          span {
            color: #ff905a;
          }
        }
        .more {
          position: absolute;
          right: 0;
          top: 0;
          cursor: pointer;
          &:hover {
            color: #009cf6;
          }
        }
        .img-content {
          display: flex;
          flex-wrap: wrap;
          padding: 20px 2px;
          .item {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            border:1px solid blue;
            margin: 10px 5px 35px 5px;
            img{
              width:100%;
            }
            div{
              text-align: center;
              padding-top:15px;
            }
          }
        }
      }
    }
    .box-right {
      width: 590px;
      background: #fff;
      padding: 30px 0;
      .table {
        width: 500px;
        border-radius: 10px;
        border: 1px solid #efefef;
        margin: 0 auto;
        overflow: hidden;
        box-sizing: content-box;
        .table-head {
          display: flex;
          justify-content: space-between;
          align-items: center;
          background: #f5f5f5;
          line-height: 50px;
          position: relative;
          padding: 0 20px;
          font-size: 14px;
          time{
            font-size: 12px;
          }
          i {
            position: absolute;
            top: 15px;
            right: 20px;
            font-size: 20px;
            cursor: pointer;
          }
        }
        .table-content {
          background: #fff;
        }
      }
      .table-1 {
        .table-content {
          display: flex;
          justify-content: center;
          align-items: center;
          padding: 20px 0;
          .circle {
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
          }
          .left {
            width: 70px;
            height: 70px;
            border: 5px solid #06c280;
          }
          .center {
            width: 80px;
            height: 80px;
            border: 5px solid #009cf6;
            margin:0 20px;
          }
          .right {
            width: 70px;
            height: 70px;
            border: 5px solid #df6733;
          }
          .text {
            text-align: center;
            margin-top: 20px;
          }
        }
      }
      .table-2 {
        margin-top: 30px;
        .list {
          display: flex;
          flex-wrap: wrap;
          padding: 10px 0;
          .item {
            width: 40px;
            line-height:40px;
            text-align: center;
            border-radius: 50%;
            color: #fff;
            margin: 5px;
            cursor: pointer;
          }
          .hook {
            background: #06c280;
          }
          .fork {
            background: #df1263;
          }
        }
      }
    }
  }
  .answer-popup {
    .sec-title {
      font-size: 14px;
      font-weight: bold;
    }
    .sec-content {
      margin: 10px 0 20px 0;
      line-height: 1.4;
    }
    .cont1 {
      .xz {
        label {
          margin: 10px 0;
        }
      }
    }
    .cont2 {
      .xz {
        display: flex;
        justify-content: space-between;
      }
    }
    .cont3 {
      .xz > div {
        margin: 5px 0;
      }
    }
  }
}
</style>
